import UIKit
import Flutter

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
  override func application(
    _ application: UIApplication,
    didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
  ) -> Bool {
    GeneratedPluginRegistrant.register(with: self)

    let controller:FlutterViewController = window.rootViewController as! FlutterViewController;
    let userdefault = FlutterMethodChannel(name: "cn.mrlong.study.ios/plugin", binaryMessenger: controller);
    userdefault.setMethodCallHandler { (call, result) in
        //String res = await PLATFORM_IOS.invokeMethod('data', 'playerUrlIos');
        //       platresult = await platform.invokeMethod(/*cell.method*/'setToken',/*cell.arguments*/"我是一个token",);
        if "data" == call.method{
            //self.setPlatString(result: result, tokenStr: call.arguments as! String)
            //判断参数：如果不为空直接跳转到播放界面
            result("ios->swift返回值")
        }else{
            result(FlutterMethodNotImplemented)
        }
    }

    return super.application(application, didFinishLaunchingWithOptions: launchOptions)
  }
}
